package com.wpf.springbootflux.dao;

import com.wpf.springbootflux.bean.Person;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

@Repository
public interface PersonDao extends ReactiveMongoRepository<Person,String> {

    /**
     * 使用spring data jpa 会自动提示
     * @param start
     * @param end
     * @return
     */
    Flux<Person> findByAgeBetween(int start, int end);


    @Query("{'age':{'$gte':20,'$lte':30}}")
    Flux<Person> queryPerson();

}
